<?php

/**
 * Product form base class.
 *
 * @method Product getObject() Returns the current form's model object
 *
 * @package    Manager
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseProductForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'clientCharge_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ClientCharge'), 'add_empty' => false)),
      'agentCharge_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AgentCharge'), 'add_empty' => false)),
      'blogger_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Blogger'), 'add_empty' => false)),
      'user_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => false)),
      'product'             => new sfWidgetFormInputText(),
      'url'                 => new sfWidgetFormInputText(),
      'startdate'           => new sfWidgetFormInputText(),
      'enddate'             => new sfWidgetFormInputText(),
      'pledgetime'          => new sfWidgetFormInputText(),
      'sale'                => new sfWidgetFormInputText(),
      'cost'                => new sfWidgetFormInputText(),
      'deadline'            => new sfWidgetFormInputText(),
      'client_note'         => new sfWidgetFormTextarea(),
      'agent_note'          => new sfWidgetFormTextarea(),
      'client_payment_time' => new sfWidgetFormDate(),
      'agent_payment_time'  => new sfWidgetFormDate(),
      'client_request_date' => new sfWidgetFormDate(),
      'agent_request_date'  => new sfWidgetFormDate(),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'clientCharge_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ClientCharge'))),
      'agentCharge_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AgentCharge'))),
      'blogger_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Blogger'))),
      'user_id'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'))),
      'product'             => new sfValidatorString(array('max_length' => 255)),
      'url'                 => new sfValidatorString(array('max_length' => 255)),
      'startdate'           => new sfValidatorPass(),
      'enddate'             => new sfValidatorPass(),
      'pledgetime'          => new sfValidatorInteger(array('required' => false)),
      'sale'                => new sfValidatorInteger(),
      'cost'                => new sfValidatorInteger(),
      'deadline'            => new sfValidatorPass(),
      'client_note'         => new sfValidatorString(array('max_length' => 4000, 'required' => false)),
      'agent_note'          => new sfValidatorString(array('max_length' => 4000, 'required' => false)),
      'client_payment_time' => new sfValidatorDate(),
      'agent_payment_time'  => new sfValidatorDate(),
      'client_request_date' => new sfValidatorDate(array('required' => false)),
      'agent_request_date'  => new sfValidatorDate(array('required' => false)),
      'created_at'          => new sfValidatorDateTime(),
      'updated_at'          => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('product[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Product';
  }

}
